package com.qf.micro_hotal;

import com.qf.commons.BloomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class ApplicationRunning implements CommandLineRunner {

    @Autowired
    private BloomUtil bloomUtil;

    @Autowired
    private StringRedisTemplate redisTemplate;

    @Override
    public void run(String... args) throws Exception {
        if (!redisTemplate.hasKey("djlbloom")) {
            //初始化布隆过滤器
            bloomUtil.bloomInit("djlbloom", 0.001, 10000000);
        }
    }
}
